package com.zsxb.crm.mapper;

import com.github.pagehelper.Page;
import com.zsxb.crm.annotation.AutoFill;
import com.zsxb.crm.annotation.Log;
import com.zsxb.crm.dto.ActivityDto;
import com.zsxb.crm.dto.ActivityPageDto;
import com.zsxb.crm.enumeration.OperationType;
import com.zsxb.crm.pojo.Activity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ActivityMapper {
    //活动查询
    Page<Activity> pageQuery(ActivityPageDto dto);
    //添加活动
    //@Log
    @AutoFill(OperationType.INSERT)
    void insertSelective(ActivityPageDto dto);
    //删除活动

    void delete(Long id);
    //修改活动
    //@Log
    @AutoFill(OperationType.UPDATE)
    void update(ActivityDto dto);
    //根据id查询活动
    @Select("select * from tb_activity where id = #{id}")
    Activity getById(Long id);

    @Select("select * from tb_activity where id = #{id}")
    Activity getByActivityId(String id);

    @Select("select * from tb_activity where channel = #{channel}")
    List<Activity> getActivityByChannel(Integer channel);

    @Select("select name from tb_activity where id=#{activityId}")
    String findNameById(Long activityId);
}
